package mygame;

import gui.StartScreenController;

public abstract class StateSwitcher {
    
    public static void startNewGame() {
        StateSwitcher.loadInGameState();
        Main.createWorld();
    }

    public static void loadMainMenuState() {
	DataStore.flyCam.setEnabled(false);
	DataStore.nifty.fromXml("Interface/mainmenu.xml", "start", new StartScreenController());
        //DataStore.nifty.setDebugOptionPanelColors(true);
    }

    public static void loadInGameState() {
        DataStore.rootNode.attachChild(DataStore.worldStateNode);
	DataStore.stateManager.attach(DataStore.bulletAppState);
        //DataStore.bulletAppState.getPhysicsSpace().enableDebug(DataStore.assetManager);
	DataStore.stateManager.attach(DataStore.aiAppState);
        DataStore.stateManager.attach(DataStore.inGameInputAppState);
	DataStore.flyCam.setEnabled(true);
    }

    public static void loadPausedState() {
	DataStore.flyCam.setEnabled(false);
        //TODO not really sure how to correctly pause/unpause the game
        DataStore.stateManager.detach(DataStore.bulletAppState);
        DataStore.stateManager.detach(DataStore.aiAppState);
        DataStore.stateManager.detach(DataStore.inGameInputAppState);
        DataStore.rootNode.detachChild(DataStore.worldStateNode);
	DataStore.nifty.fromXml("Interface/pausemenu.xml", "start");
    }
}
